package com;

import java.util.Scanner;

public class LuckyPage {
	public static void goDraw(int id) {
		if (LoginPage.isLogin) {
			System.out.println("[会员系统>>抽奖]");
			System.out.println("请输入你的会员卡号：");
			Scanner input_card = new Scanner(System.in);
			int number = input_card.nextInt();
			
			// 生成5个4位随机数字，并保存在数组中
			int[] luckyNumbers = new int[5];
			int i = 0;
			System.out.print("\n本日的幸运数字为：");
			for (i = 0; i < luckyNumbers.length; i++) {
				luckyNumbers[i] = (int) (Math.random()*(RegPage.max-RegPage.min))+RegPage.min;
				System.out.print(luckyNumbers[i] + ",");
			}
			for (i = 0; i < luckyNumbers.length; i++) {
				if (RegPage.cardNumber == luckyNumbers[i]) {
					System.out.println("恭喜中奖！");
					break;
				}
			}
			if (i ==luckyNumbers.length) {
				System.out.println("\n很遗憾，你不是今日的幸运会员");
			}
		/*	int a,b,c,d;
			int m = (int) (Math.random()*(RegPage.max-RegPage.min))+RegPage.min;
			a = m;
			b = m;
			c = m;
			d = m;
			System.out.println("今日的幸运数字为：" + a +","+ b +"," + c +"," + d);
			if ((RegPage.cardNumber == a) ||(RegPage.cardNumber == b) 
					||(RegPage.cardNumber == c ) || (RegPage.cardNumber == d)) {
				System.out.println("恭喜中奖！");
			}else{
				System.out.println("很遗憾，你不是今日的幸运会员");
			}*/
		}else {
			System.out.println("请先注册,登陆,再抽奖!");
			String answer = Temp.todo();
			if ("n".equals(answer)) {
				System.out.println("***********************");
				System.out.println("系统退出,谢谢使用!");
			}else if ("y".equals(answer)) {
				RegPage.reg(id-2);
			}
		}
	}
}
